package ua.kpi_java_training.evgeniygusar.module2.tests;

import org.junit.Test;
import ua.kpi_java_training.evgeniygusar.module2.*;

public class AllVictimsTest {
    static Predator p = new Predator();
    AllVictims victimsObject = new AllVictims();
    Pool mypool = new Pool();
    int X_BORDER, Y_BORDER;

    public AllVictimsTest() {
        X_BORDER = mypool.getXBorder();
        Y_BORDER = mypool.getYBorder();
    }

    @Test
    public void testNearestVictim() throws Exception {
        p.x = 6;
        p.y = 5;

        victimsObject.addVictim();
        victimsObject.getVictim(0).x = 5;
        victimsObject.getVictim(0).y = 4;

        victimsObject.addVictim();
        victimsObject.getVictim(1).x = 9;
        victimsObject.getVictim(1).y = 9;

        victimsObject.nearestVictim(p.x, p.y);
        assert(0==victimsObject.getIndexOfNearestVictim());
        assert(5==victimsObject.getXOfNearestVictim());
        assert(4==victimsObject.getYOfNearestVictim());
    }

    @Test
    public void testAddVictim() throws Exception {
        victimsObject.addVictim();
        assert(3==victimsObject.numbersOfVictims());

    }

    @Test
    public void testGetVictim() throws Exception {
        assert(5==victimsObject.getVictim(0).x);
    }

    @Test
    public void testRemoveVictim() throws Exception {
        victimsObject.removeVictim(2);
        assert(2==victimsObject.numbersOfVictims());
    }

    @Test
    public void testNumbersOfVictims() throws Exception {
        assert(2==victimsObject.numbersOfVictims());
    }

    @Test
    public void testDistance() throws Exception {
        assert(5==victimsObject.Distance(3,4));
    }
}
